﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Direct.Modularity;
using Direct.Security;
using Direct.ApplicationModel;

namespace Direct.Server.Modules.Shell
{
    [Module("DirectShell")]
    [ModuleCategory(ModuleCategory.Core)]
    [ModulePriority(ModulePriority.High)]
    [ModuleDescription("Área de trabalho do usuário")]
    public class ShellModule : ModuleBase
    {
        protected override void InitializeInternal()
        {
            base.InitializeInternal();

            var authService = ServiceLocator.GetInstance<IAuthorizationService>();

            //criar a chave de segurança do shell
            authService.CreateKey(ShellAuthKeys.Root, "Área de trabalho", Int32.MinValue);

            var appModel = ServiceLocator.GetInstance<IApplicationModelService>();

            //criar o aplicativo shell
            var shellApp = appModel.RegisterApplication(
                ShellConstants.ApplicationId,
                ShellConstants.ApplicationName,
                ShellConstants.ApplicationTitle,
                ShellConstants.ApplicationVersion,
                ShellAuthKeys.Root,
                "/Shell",
                null);

            // registrar os menus do shell
            // iniciar
            shellApp.Commands.AddItem(ShellMenus.Start, "Iniciar");
            // tools
            shellApp.Commands.AddItem(ShellMenus.Tools, "Ferramentas");
        }

    }
}
